// 
//  RequestInterceptor.swift
//  FRCore
//
//  Copyright (c) 2020 ForgeRock. All rights reserved.
//
//  This software may be modified and distributed under the terms
//  of the MIT license. See the LICENSE file for details.
//

import Foundation


/**
 RequestInterceptor is an interface that allows developers to implement to intercept Requests and modify the SDK generated Request as needed. Once RequestInterceptor is implemented, an array of RequestInterceptor can be registered to `RequestInterceptorFactory` which then every time that Request is being made from SDK, SDK invokes 'RequestInterceptor.intercept()' method to allow modification of that particular request.
 */
public protocol RequestInterceptor {
    
    /// Intercepts Request that is generated by SDK, and modifies, and returns updated Request if needed
    /// - Parameters:
    ///   - request: Original Request object generated by SDK
    ///   - action: Action represents a type of the request that is currently being made
    func intercept(request: Request, action: Action) -> Request
}
